Release 10.1A: OpenEdge Development:
ADM and SmartObjects
Initializing the foreign key fields
ForeignFieldsis a SmartDataObject property that is set at design time to designate which of its fields to map to foreign key fields in a SmartDataObject that is its parent. A corresponding property calledForeignValuesholds the values of those fields for the current row. WhenForeignFieldsis set for a particular SmartDataObject, performing theAddorCopyoperation in that SmartDataObject assigns the values of the key fields to the corresponding fields in the newly added row.Suppose you have two SmartDataObjects, CUST and ORDER, that are set up as follows:
Figure 4–1 illustrates this setup.
Figure 4–1: Inheriting foreign key field values
![]()
As the application user adds orders, the value of the ORDER SmartDataObject’s
cust-numfield is automatically set to the current value of the CUST SmartDataObject’scust-numfield; that is, 27. This is done in theaddRowfunction ofdata.pto display theForeignFieldvalue as the initial value for the new row. If the application user does not change that value (and such fields normally cannot be updated), the initial value is assigned to the new row in the proceduresubmitForeignField, called from the functionsubmitRowduring theSaveoperation. See the online help for descriptions of these functions,
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |